package com.Brave.manager.Demo01;

import java.io.File;
import java.io.IOException;

public class Demo01 {
    public static void main(String[] args) throws IOException {
        File F1 = new File("D:\\JAVA\\Braveteat.txt");
        System.out.println(F1);
        File f2 = new File("D:\\JAVA\\Bravetest", "a.txt");
        System.out.println(f2);
        File f3 = new File("D:\\JAVA\\Braveteat");
        File f4 = new File(f3, "a.txt");
        System.out.println(f4);

//        boolean r1 = F1.createNewFile();
//        System.out.println(r1);
//        boolean r2 = f2.mkdirs();
//        System.out.println(r2);
//        boolean r1d = F1.delete();
//        System.out.println(r1d);
//        boolean r2d = f2.delete();
//        System.out.println(r2d);

//        boolean f1t  = F1.exists();
//        System.out.println(f1t);
//
//        File[] list = f2.listFiles();
//        System.out.println(list);


//        File B = new File("D:\\JAVA\\Brave");
//        File b1 = new File(B,"a");
//        if(!b1.exists()){
//            b1.mkdir();
//        }
//        File b2 = new File(b1,"b.txt");
//        b2.createNewFile();

        File b3 = new File("D:\\JAVA\\Brave");
        deleteFile(b3);
    }

    private static void deleteFile(File b3) {
        File[] list = b3.listFiles();
        for(File F:list){
            if(F.isFile()){
                F.delete();
            }else {
                deleteFile(F);
            }
        }
        b3.delete();
    }
}
